package mapper;

import dto.ScheduleMasterDTO;
import entity.ScheduleMaster;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;

import java.util.List;

/**
 * 排班主表Mapper接口
 */
@Mapper
public interface ScheduleMasterMapper {

    /**
     * 插入排班信息
     * @param scheduleMaster 排班主表实体
     * @return 影响行数
     */
    @InsertProvider(type = ScheduleMasterMapperProvider.class, method = "insert")
    int insert(ScheduleMaster scheduleMaster);

    /**
     * 根据ID删除排班信息
     * @param id 主键ID
     * @return 影响行数
     */
    @DeleteProvider(type = ScheduleMasterMapperProvider.class, method = "deleteById")
    int deleteById(@Param("id") String id);

    /**
     * 批量删除排班信息
     * @param ids 主键ID列表
     * @return 影响行数
     */
    @DeleteProvider(type = ScheduleMasterMapperProvider.class, method = "batchDelete")
    int batchDelete(@Param("ids") List<String> ids);

    /**
     * 更新排班信息
     * @param scheduleMaster 排班主表实体
     * @return 影响行数
     */
    @UpdateProvider(type = ScheduleMasterMapperProvider.class, method = "update")
    int update(ScheduleMaster scheduleMaster);

    /**
     * 发布排班信息
     * @param id 主键ID
     * @return 影响行数
     */
    @UpdateProvider(type = ScheduleMasterMapperProvider.class, method = "publish")
    int publish(@Param("id") String id);

    /**
     * 根据ID查询排班信息
     * @param id 主键ID
     * @return 排班主表实体
     */
    @SelectProvider(type = ScheduleMasterMapperProvider.class, method = "selectById")
    ScheduleMaster selectById(@Param("id") String id);

    /**
     * 查询排班列表
     * @param scheduleMasterDTO 查询条件
     * @return 排班列表
     */
    @SelectProvider(type = ScheduleMasterMapperProvider.class, method = "selectList")
    List<ScheduleMaster> selectList(ScheduleMasterDTO scheduleMasterDTO);

    /**
     * 查询排班总数
     * @param scheduleMasterDTO 查询条件
     * @return 总数
     */
    @SelectProvider(type = ScheduleMasterMapperProvider.class, method = "selectCount")
    int selectCount(ScheduleMasterDTO scheduleMasterDTO);
}